<template>
  <view class="search-container">
    <navBar v-if="isShowCustomNavBar" :navbarData.sync="navbarData"></navBar>
    <!-- <tabBar v-if="type !== 'search'" :nowPages.sync="nowPages"></tabBar> -->
    <!-- 客服图标 -->
    <onlineService></onlineService>
    <!--  <movable-area style="width:100vw;" :style="{ height: whMovablearea }">
      <movable-view style="z-index:1000;" :x="x" :y="y" animation="false" friction="10" inertia="true" direction="all" :animation="moveAnimation">
        <onlineService></onlineService>
      </movable-view> -->

    <block v-if="type == 'search'">
      <view class="top_search" v-if="!cateCode">
        <view class="search_read_only">
          <view class="search_content">
            <block v-if="brandType == 2">
              <view class="serach_img">
                <image class="search-small-icon"
                  src="https://100000057-1252208446.cos.ap-shanghai.myqcloud.com/images/miniprogram/iocn_search.png"
                  style="width: 33.9rpx; height: 32.6rpx" mode="aspectFill"></image>
              </view>
            </block>
            <block v-else>
              <view class="serach_img" v-if=" defaultKeyword.length > 0">
                <image class="search-small-icon searchIptBx"
                  src="https://100000063-1252208446.file.myqcloud.com/images/icon@2x (3).png"
                  style="width: 33.9rpx; height: 32.6rpx" mode="aspectFill"></image>
              </view>
              <view class="serach_img" v-else>
                <image class="search-small-icon searchIptBx"
                  src="https://100000063-1252208446.file.myqcloud.com/images/icon@2x (1).png"
                  style="width: 33.9rpx; height: 32.6rpx" mode="aspectFill"></image>
              </view>


            </block>
            <input type="text" class="search_input u-color-1a" style="position: relative; z-index: 2"
              placeholder-class="phcolor" placeholder="请输入威士忌名称" :value="defaultKeyword" @focus="getfocus"
              @input="inputValue" confirm-type="search" @confirm="searchKeyWord" />
            <view class="search_right">
              <view @click="bindClose" class="serach_img">
                <view class="serach_img" v-if="defaultKeyword.length > 0 && showSearchClear">
                  <image class="search-small-icon searchIptBx"
                    src="https://100000063-1252208446.file.myqcloud.com/images/icon@2x (2).png"
                    style="width: 25.5rpx; height: 25.5rpx" mode="aspectFill"></image>
                </view>
              </view>
              <!-- <view
                class="right-Item"
                @click="searchKeyWord"
                :data-search="search"
              >
                <text class="iconfont icon-jiantouxiangzuo"></text>
              </view> -->
              <view class="right-Item" @click="searchKeyWord" :data-search="search">
                搜索
              </view>
            </view>
          </view>
        </view>
      </view>
      <view class="search_btm_line"></view>

      <block v-if="show">
        <view class="history" v-if="keywordhisList.length > 0">
          <view class="title">
            <text class="doc">历史搜索</text>
            <view class="icon-search" @click.stop="clearHis">
              <image mode="widthFix" src="https://100000063-1252208446.file.myqcloud.com/images/Trash@2x (1).png"
                style="height: 20rpx; width: 20rpx"></image>
            </view>
            <!-- <span class="iconfont icon-lajitong" @click.stop="clearHis"></span> -->
          </view>
          <view class="lable">
            <view v-for="(item, index) in keywordhisList" :key="index" @click.stop="selHisKeyWord">
              <view class="child" :data-text="item" data-type="历史搜索">{{
                item
              }}</view>
            </view>
          </view>
        </view>

        <view v-if="showhotWordList == true" class="history">
          <view class="doc">热门搜索</view>
          <view class="lable">
            <view v-for="(item, index) in hotWordList" :key="index" @click.stop="selHisKeyWord">
              <view class="child" :data-text="item.hotword" data-type="热门搜索">{{ item.hotword }}</view>
            </view>
          </view>
        </view>
      </block>

      <view v-if="searchError">
        <placeholder :is_empty.sync="is_empty" :messageSeach="defaultKeyword" :showmessageSeach.sync="showmessageSeach">
        </placeholder>
      </view>
    </block>

    <view class="container u-bg-color">
      <!--     <view v-if="searchError == false">
        <filterBar
          v-if="isSort == 0 || isFilter > 0"
          :cateCode="cateCode"
          @currentType="currentType"
          @arrowType="arrowType"
          :isSort="isSort"
          :isFilter="isFilter"
          :colorFilter.sync="colorFilter"
          :materialFilter.sync="materialFilter"
          :sizeFilter.sync="sizeFilter"
          :styleFilter="styleFilter"
        ></filterBar>
      </view> -->
      <view class="pb120" v-if="list.length > 0 && searchError == false">
        <!--矩阵商品列表模块-->
        <view class="pb60">
          <productGridList class="qqqqq" ref="childItem" :searchType.sync="searchType"
            :defaultKeyword.sync="defaultKeyword" :list.sync="list" :listResult.sync="listResult1"
            :hasMore.sync="hasMore" :isAppend.sync="isAppend" :purchasetype.sync="purchasetype"
            :finishLoadFlag.sync="finishLoadFlag" :categoryName.sync="categoryName" :groupId.sync="customerGroupId"
            :cateCode="cateCode" :bannerItemsArr.sync="bannerItemsArr" :bannerPosition.sync="bannerPosition"
            :footerBannerPosition.sync="footerBannerPosition" :userOrderLists="userOrderLists" :type="type">
          </productGridList>
        </view>
        <view class="pb60">
          <productGridList class="wwwww" ref="childItem" :searchType.sync="searchType"
            :defaultKeyword.sync="defaultKeyword" :list.sync="list" :listResult.sync="listResult2"
            :hasMore.sync="hasMore" :isAppend.sync="isAppend" :purchasetype.sync="purchasetype"
            :finishLoadFlag.sync="finishLoadFlag" :categoryName.sync="categoryName" :groupId.sync="customerGroupId"
            :cateCode="cateCode" :bannerItemsArr.sync="bannerItemsArr" :bannerPosition.sync="bannerPosition"
            :footerBannerPosition.sync="footerBannerPosition" :userOrderLists="userOrderLists" :type="type">
          </productGridList>
        </view>
      </view>
      <block v-if="filterChecked.fliterCmsFooterBanner(bannerPosition)">
        <bannerPlugin :bannerItemsArr.sync="bannerItemsArr" :footerBannerPosition.sync="footerBannerPosition">
        </bannerPlugin>
      </block>
      <block v-else>
        <view v-if="hasMore > 0" class="hasMore">已到页面底部</view>
      </block>
      <!--加载更多时动画-->
      <loadMore :show.sync="showLoading" message="加载中"></loadMore>
      <!--暂无数据显示-->
      <placeholder :show.sync="is_empty" message="没有相关信息"></placeholder>
      <!-- utools 推荐更多 -->
      <block v-if="type == 'search' && !!utoolsData && utoolsClassGoodsLists" style="margin-top: 100rpx">
        <utools-parse id="utools-parse" page="category" @triggerComponent="onTriggerComponent" :utools-data="utoolsData"
          @onAddCart="onAddCart"></utools-parse>
      </block>
    </view>
    <!-- </movable-area> -->

    <register-widget ref="registerWidgetRef" location="category" @finish="onRegisterWidgetFinish" :tsActId="tsActId"
      @registerSuccess='registerSuccess' />
    <cart-toast v-if="showCartMsg" :cartMessage='cartMessage' :cartStatus='cartStatus' bottom="64rpx"></cart-toast>
    <view class="ios_safe_zone" v-if="isIos">
      <view class="ios_safe_zone_line"></view>
    </view>
		<!-- 弱提示 弹窗 -->
		<toast-popup ref="toastPopup" @onToastPopupClick="onToastPopupClick"></toast-popup>
  </view>
</template>
<script module="filterChecked" lang="wxs" src="../../utils/filter.wxs"></script>
<script>
  import api from "@/api/api";
  import {
    USER_INFO,
    CART_KEY,
    SYSTEM_INFO,
    USER_SPECICAL_INFO,
    MERCHANT_INFO,
    CUSTOMER_INFO,
    LOWER_WX_VERSION,
  } from "@/utils/constant";
  import FilterBar from "@/components/filterBar/filterBar";
  import ProductGridList from "@/components/productGridList/productGridList";
  import LoadMore from "@/components/common/loadMore";
  import Placeholder from "@/components/common/placeholder";
  import NavBar from "@/components/common/navbar";
  import onlineService from "@/components/common/onlineService";
  import Loading from "@/components/common/loading";
  import TabBar from "@/components/common/tabbar";
  import CartToast from '@/components/common/cartToast.vue';
  import registerWidget from "@/components/register/register-widget.vue";
  export default {
    components: {
      navBar: NavBar,
      filterBar: FilterBar,
      productGridList: ProductGridList,
      loadMore: LoadMore,
      placeholder: Placeholder,
      onlineService: onlineService,
      loading: Loading,
      tabBar: TabBar,
      CartToast,
      registerWidget: registerWidget,
    },
    data() {
      return {
        navbarData: {
          showCapsule: 0, //是否显示左上角图标   1表示显示    0表示不显示
          navbarTitle: "",
        },
        isShowCustomNavBar: true,
        nowPages: "",
        showLoaded: false,
        type: "search", // category/search

        hasMore: 0,
        finishLoadFlag: 0,
        list: [],
        preview: false,
        searchType: "",
        showLoading: false,
        //防止重复加载
        preventRepeatReuqest: false,
        purchasetype: 1,
        is_empty: false,
        is_filter: false,
        //当前页面
        currentPage: 1,
        //总页数
        pageTotal: 0,
        pageSize: 16,

        // 搜索
        showSearchClear: false,
        defaultKeyword: "",
        searchError: false,
        keywordhisList: [],
        hotWordList: [],
        showhotWordList: true,
        hotwordVisibility: 1,

        cateCode: "",
        categoryName: "",
        // 商户id
        merchantId: "",
        show: false,

        isSort: 1, //是否显示排序           0显示 1不显示
        isFilter: "", //是否显示筛选          0 不显示 1 显示
        isAppend: 0, // 是否显示悬浮图    0 不显示 1 显示
        is_sort: "",
        color_filter: "",
        material_filter: "",
        size_filter: "",
        style_filter: "",
        // 全部的筛选数据
        colorFilter: [],
        materialFilter: [],
        sizeFilter: [],
        styleFilter: [],
        bannerContents: [],
        bannerItems: [],
        bannerPosition: [],
        bannerItemsArr: [],
        banners: [],
        footerBannerPosition: "",
        listResult: [],
        tempListLength: [],
        // 品牌信息 0：三仟院  1：ICH  2:PB
        brandType: getApp().globalData.brandType,
        memberLevelId: 0,
        customerGroupId: 0,
        identifier: "cms/itemrecommend",
        showmessageSeach: false,
        listResult1: [],
        listResult2: [],
        utoolsData: null,
        afterPage: "",
        utoolsClassGoodsLists: null,
        resList1: [],
        resList2: [],
        resultList: [], //搜索全部结果
        userOrderLists: [],
        goods: null,
        showCartMsg: false,
        cartMessage: '',
        cartStatus: false,
        registerType: '',
        isIos: false,
      };
    },

    async onLoad(option) {
      this.utoolsData = await this.getHomeUtoolsData();
      await this.getUtoolsClassGoodsLists()
      let that = this;
      this.type = option.type || "search";
      this.list = [];
      this.cateCode = option.cateCode;
      this.categoryName = option.title || "搜索";
      this.defaultKeyword = option.keyword || "";
      this.preview = option.preview ? option.preview : false;
      this.merchantId = uni.getStorageSync(MERCHANT_INFO).cloudMerchantId;
      this.storeId = uni.getStorageSync(MERCHANT_INFO).cloudMerchantStoreId;

      that.isSort = option.isSort;
      that.isFilter = option.isFilter;
      that.isAppend = option.isAppend;
      that.getCurrentMerchantInfo();

      if (uni.getStorageSync("keywordhisList").length > 0) {
        this.keywordhisList = uni.getStorageSync("keywordhisList");
      }
      this.isIos = wx.getSystemInfoSync().system.includes('iOS') && wx.getSystemInfoSync()?.safeArea?.top > 20;
      // that.$commonSensors.searchActive("搜索按钮");

      // this.categoryCmsBanners();

    },

    async onShow() {
      let memberDetails = uni.getStorageSync("memberDetails");
      let customerInfo = uni.getStorageSync("customerInfo");
      this.memberLevelId = memberDetails.memberLevelId || 0;
      this.customerGroupId = customerInfo.groupId || 0;
      let pages = getCurrentPages();
      let currPage = pages[pages.length - 1];
      let prevpage = pages[pages.length - 2];
      this.nowPages = currPage.route;

      if (this.type == "search") {
        this.navbarData.showCapsule = 1;
        if (prevpage == undefined) {
          this.navbarData.hideHome = false;
        } else {
          this.navbarData.hideHome = true;
        }
      }
      getApp().cl_tracker.track("mini_program_view", {
        path: this.nowPages,
        pageName: "搜索",
      });
      // this.userOrderLists = await this.getOrder();
    },

    methods: {
			/**
			 * 展示弱提示
			 * @param {Object} msg 文案
			 */
			handleShowTextToast(msg){
				try{
					this.$refs.toastPopup.showToast(msg);
				}catch(e){}
			},
			/**
			 * 若提示按钮点击回调
			 * @param {Object} data.type 类型：confirm确定，cancel取消
			 * @param {Object} data.callBackData 呼气弹窗时传入的数据
			 */
			onToastPopupClick(data){},
      async getUtoolsClassGoodsLists() {
        const _reslists = await this.getCateGoods(this.utoolsData?.classId || 8066)
        _reslists.forEach(item => {
          if (item?.hdlpImgUrl) item.hoverUrl = item.hdlpImgUrl;
        })
        this.utoolsClassGoodsLists = _reslists
      },
      // 加购
      onAddCart(e) {
        const {
          data
        } = e.detail
        this.goods = data
        this.addCart(e)
      },
      // 商品加入购物车功能
      async addCart(e) {
        try {
          const {
            data
          } = e.detail
          let that = this
          let merchantInfo = uni.getStorageSync('merchantInfo');
          let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
          let userInfo = uni.getStorageSync(USER_INFO);
          if (!customerInfo && !userInfo) {
            that.registerType = 'cart';
            that.getUserProfile();
            return false;
          } else if (!customerInfo && !!userInfo) {
            that.registerType = 'cart';
            that.$refs.registerWidgetRef.openJoinMemberModal()
            return false;
          }
          let goodsInfo = await this.getGoodsDetail(merchantInfo, data.itemId)
          if (!goodsInfo || goodsInfo.code != 1000) return this.handleCartToast({
            success: false,
            msg: "加入购物车失败"
          });
          // 加入购物车
          const cartRes = await this.$commonFunction.buildProductsAddCart({
            price: goodsInfo.data.skus[0].price,
						itemId: goodsInfo.data.itemId,
            valueId: goodsInfo.data.frontProperties[0].valueId,
            itemCode: goodsInfo.data.itemId,
            itemName: goodsInfo.data.itemName,
            qty: 1,
            skuCode: goodsInfo.data.skus[0].skuCode,
            skuId: goodsInfo.data.skus[0].skuId,
          });
          //  加入购物车提示
          this.handleCartToast(cartRes);
        } catch (e) {
          this.handleCartToast({
            success: false,
            msg: "加入购物车失败"
          });
        }
      },

      getUserProfile: async function() {
        let that = this
        this.$commonFunction.commonLoginNew().then(res => {
          if (res.code !== 1000) {
            this.$refs.registerWidgetRef.openJoinMemberModal()
          } else if (res.data && res.data.mobile) {
            //  非大陆手机号按照非会员对待,重新入会
            const phoneNumberReg = /^1\d{10}$/;
            if (!phoneNumberReg.test(res.data.mobile)) {
              this.$refs.registerWidgetRef.openJoinMemberModal()
            }
          }
        }).catch(err => {
          this.$refs.registerWidgetRef.openJoinMemberModal()
        })
      },
      /**
       * 加购提示
       * @param {Object} obj
       */
      async handleCartToast(obj) {
				const _arr = ['您动作太快，请慢点哟～', '网络状态不佳，请重试'];
				if(obj.msg && _arr.includes(obj.msg)){
					this.handleShowTextToast(obj.msg)
				}else if(obj.data && obj.data.msg && obj.data.type === 'showToast'){
					this.handleShowTextToast(obj.data.msg)
				}else{
					if (obj?.success) this.getCartList();
					this.cartMessage = obj?.msg || "加入购物车失败";
					this.cartStatus = obj?.success || false;
					this.showCartMsg = true;
					setTimeout(() => {
					  this.showCartMsg = false;
					}, 3000);
				}
      },
      //获取商品详情
      async getGoodsDetail(merchantInfo, itemId) {
        const json = await api.goodsDetail({
            query: {
              merchant_id: merchantInfo.cloudMerchantId,
              store_id: merchantInfo.cloudMerchantStoreId
            }
          },
          itemId
        );
        return json
      },
      onTriggerComponent(e) {
        try {
          this.$commonUtoolsTrack.onTriggerComponent(e);
        } catch (e) {}
      },
      async registerSuccess() {
        // let that = this
        // that.showRegister = 1
        return null
        // that.$refs.cmsPage.toParseRegisterSuccess()
      },
      async getHomeUtoolsData() {
        let json = await api.getUtoolsJson({
          type: "recommendPage",
        });
        return json.success && json?.data ? JSON.parse(json.data) : null
      },
      //获取购物车商品列表
      getCartList: async function() {
        let that = this;
        let cart_key = uni.getStorageSync(CART_KEY);
        let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
        try {
          if (jwt && cart_key !== null) {
            that.$commonFunction.getCartList().then((res) => {
              if (res && res.items !== null) {
                getApp().globalData.cartNum = res.availableTotalQty;
                that.cartNum = res.availableTotalQty;
                that.$store.commit('changeCartNum', res.availableTotalQty);
                uni.setStorageSync('cartNum', res.availableTotalQty);
              }
            }).catch((err) => {
              that.handleShowTextToast(err.msg);
            });
          }
        } catch (err) {}
      },
      //  查询首页商品分类列表
      async getCateGoods(class_id, is_sort) {
        try {
          //获取商品
          let merchantInfo = uni.getStorageSync(MERCHANT_INFO)
          let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
          let res = await this.$commonFunction.doSearchGoods(class_id, '', 1, 200, null, '', is_sort, '', '', '', '')
          let cateProductList = res.data.content; // 商品列表
          //sku实时库存查询
          let skuCodeList = [],
            goodsQ = [];
          for (let i = 0; i < cateProductList.length; i++) {
            skuCodeList = skuCodeList.concat(cateProductList[i].skuCodes)
          }

          if (skuCodeList.length) {
            skuCodeList = await this.setSkuCodeList(skuCodeList)
            for (let i = 0; i < skuCodeList.length; i++) {
              let reset = await this.getAvailableBatchQty(customerInfo, merchantInfo, skuCodeList[i]);
              goodsQ = reset.length ? goodsQ.concat(reset) : goodsQ
            }
          }

          // 策略价格
          let list = [];
          cateProductList = cateProductList.map(async item => {
            item.frontQty = 0
            let res = await this.$commonFunction.priceRulesDeal(item.strategies, item.itemmCode)
            if (goodsQ && goodsQ.length) {
              for (let i = 0; i < goodsQ.length; i++) {
                if (item.skuCodes.indexOf(goodsQ[i].skuCode) !== -1 && goodsQ[i].availableQty > 0) {
                  item.frontQty += goodsQ[i].availableQty
                }
              }
            }
            if (res.price !== 0) {
              if (item.itemCode == res.itemCode) {
                item.price = res.price
              }
            }
            if (res.rulesArr.length > 0) {
              if (item.itemCode == res.itemCode) {
                item.rulesArr = res.rulesArr
              }
            }
            list.push(item)
            return item
          })
          return list
        } catch (err) {
          return null
        }
      },
      async setSkuCodeList(skuCodeList) {
        if (skuCodeList.length < 21) {
          return [skuCodeList]
        } else {
          const result = skuCodeList.flatMap((value, index, array) => {
            if (index % 20 === 0) {
              return [array.slice(index, index + 20)];
            }
            return [];
          });
          return result
        }
      },

      async getAvailableBatchQty(customerInfo, merchantInfo, skuCodeList) {

        let reset = await api.getAvailableBatchQty({
          method: "POST",
          header: {
            'jwt': customerInfo.jwt,
            'content-type': 'application/json'
          },
          // query: JSON.stringify(skuCodeList)
          query: skuCodeList
        }, merchantInfo.cloudMerchantId);
        if (reset.msg == "SUCCESS" && reset?.data?.length) {
          return reset.data.filter(item => item.availableQty > 0)
        } else {
          return []
        }
      },
      //-----------
      // bindInput() {
      //   this.$commonSensors.searchActive("搜索框");
      // },
      // 判断是否有merchantInfo,没有则重新请求
      getCurrentMerchantInfo: async function() {
        let that = this;
        var merchantInfo = uni.getStorageSync(MERCHANT_INFO) || "";
        this.merchantId = uni.getStorageSync(MERCHANT_INFO).cloudMerchantId || "";
        this.storeId =
          uni.getStorageSync(MERCHANT_INFO).cloudMerchantStoreId || "";

        if (merchantInfo) {
          if (this.defaultKeyword) {
            that.doSearchGoods(
              "",
              this.categoryName,
              that.merchantId,
              that.storeId,
              this.defaultKeyword,
              this.is_sort,
              this.color_filter,
              this.material_filter,
              this.size_filter,
              ""
            );
          } else {
            this.show = true;
            this.getKeyWordHisList(
              this.hotwordVisibility,
              this.merchantId,
              this.storeId
            );
          }
        } else {
          // 获取商户信息
          const accountInfo = uni.getAccountInfoSync(); // 小程序appId
          var merchantInfo = await api.merchantInfo(
            accountInfo.miniProgram.appId
          );
          if (merchantInfo.code === 200) {
            // 存储商户信息
            uni.setStorageSync(MERCHANT_INFO, merchantInfo.data);
            that.storeId = merchantInfo.data.cloudMerchantStoreId;
            that.merchantId = merchantInfo.data.cloudMerchantId;

            if (this.defaultKeyword) {
              that.doSearchGoods(
                "",
                this.categoryName,
                that.merchantId,
                that.storeId,
                this.defaultKeyword,
                this.is_sort,
                this.color_filter,
                this.material_filter,
                this.size_filter,
                ""
              );
            } else {
              this.show = true;
              this.getKeyWordHisList(
                this.hotwordVisibility,
                this.merchantId,
                this.storeId
              );
            }
          }
        }
      },

      /**
       * 搜索商品 商品列表
       */
      doSearchGoods: async function(
        class_id,
        category_name,
        merchant_id,
        store_id,
        q = "",
        is_sort,
        color_filter,
        material_filter,
        size_filter,
        style_filter
      ) {
        let that = this;
        let memberDetails =
          uni.getStorageSync("memberDetails") ||
          getApp().globalData.memberDetails;
        let merchantInfo =
          uni.getStorageSync(MERCHANT_INFO) || getApp().globalData.merchantInfo;
        let customerInfo = uni.getStorageSync("customerInfo");
        // 获取商品列表
        let after = that.currentPage == 1 ? "" : that.afterPage;
        const res = await that.$commonFunction.doSearchGoods(
          class_id,
          category_name,
          that.currentPage,
          that.pageSize,
          after,
          q,
          is_sort,
          color_filter,
          material_filter,
          size_filter,
          style_filter
        );
        try {
          that.afterPage = res.data.afterPage;
          if (that.currentPage == 1 && res.data.content.length == 0) {
            that.is_empty = true;
            that.showmessageSeach = true;
          }
          that.list = [...that.list, ...res.data.content];
          if (that.currentPage == 1) {
            that.list = res.data.content;
          }
          let itemsList = res.data;
          that.colorFilter = itemsList.color_filter_data;
          that.materialFilter = itemsList.material_filter_data;
          that.sizeFilter = itemsList.size_filter_data;
          that.styleFilter = itemsList.style_filter_data;
          that.page_total = Math.ceil(res.data.total / 16);
          // 策略价格
          var s_item = [];
          for (var i in that.list) {
            s_item = that.list[i];
            if (!!that.list[i].strategies) {
              that.$commonFunction
                .priceRulesDeal(that.list[i].strategies, that.list[i].itemCode)
                .then((res) => {
                  if (res.price !== 0) {
                    that.list.map((itey) => {
                      if (itey.itemCode == res.itemCode) {
                        itey.price = res.price;
                      }
                    });
                  }
                  if (res.rulesArr.length > 0) {
                    that.list.map((itey) => {
                      if (itey.itemCode == res.itemCode) {
                        itey.rulesArr = res.rulesArr;
                      }
                    });
                  }
                })
                .catch((err) => {});

              // let result = await getApp().priceRulesDeal(that.list[i].strategies);
              // if (result.price !== 0) {
              //   that.list[i].price = result.price;
              // }
              // if (result.rulesArr.length > 0) {
              //   that.list[i].rulesArr = result.rulesArr;
              // }
            }

            var customPromotionTags = [];
            var isForwardpurchaseGoods = false;
            for (var t in s_item["promotionTagList"]) {
              var tagItem = s_item["promotionTagList"][t];
              if (tagItem.promotionType == "custom_tag") {
                customPromotionTags.push(tagItem);
              }

              if (tagItem.promotionType == "forward_purchase") {
                isForwardpurchaseGoods = true;
              }
            }

            let tempTagList = customPromotionTags.slice();
            tempTagList.sort((a, b) => {
              return a.sortOrder - b.sortOrder;
            });

            that.list[i]["customPromotionTags"] = tempTagList;
            that.list[i]["isForwardpurchaseGoods"] = isForwardpurchaseGoods;
          }
          // 搜索错误提示
          if (q != "" && that.page_total == 0 && that.list.length < 1) {
            that.searchError = true;
          } else {
            that.searchError = false;
          }
          that.showLoaded = false;

          //重新组合包含banner的商品列表
          that.newList();
          for (let i = 0; i < res.data.content.length; i++) {
            if (res.data.content[i].skuCodes !== undefined) {
              this.$sr.track("expose_sku_component", {
                sku: {
                  sku_id: res.data.content[i].skuCodes[0].toString(),
                  sku_name: res.data.content[i].itemName, // 若商品无sku_name时，可传spu_name信息
                },
                spu: {
                  spu_id: !!uni.getStorageSync("openOuterItemId") ?
                    res.data.content[i].outerItemId :
                    !!uni.getStorageSync("youshuOpencc") ?
                    res.data.content[i].frontCode.toString() : res.data.content[i].itemCode.toString(),
                  spu_name: !!uni.getStorageSync("youshuOpencc") ?
                    res.data.content[i].itemName + res.data.content[i].valueName : res.data.content[i]
                    .itemName, // 若商品无spu_name时，可传sku_name信息
                },
                sku_category: [{
                  sku_cat_id: res.data.content[i].categoryId.toString(),
                  sku_cat_name: "全部商品",
                  sku_parent_cat_id: "null", // 若已是顶级类目，传"null"
                }, ],
                shipping_shop: {
                  shipping_shop_id: merchantInfo.cloudMerchantId.toString(), // 到家类型对接智慧零售入口必传
                  shipping_shop_name: "THE MACALLAN EBOUTIQUE麦卡伦", // 到家类型对接智慧零售入口必传
                },
                sale: {
                  original_price: parseFloat(res.data.content[i].price), // 对接智慧零售入口必传
                  current_price: parseFloat(res.data.content[i].price), // 对接智慧零售入口必传
                },
                primary_image_url: res.data.content[i].majorUrl,
                // more...
              });
            }
          }
        } catch (err) {
          that.handleShowTextToast(err.msg);
        }
        // for (let i=0;i<this.list.length;i++){
        //    this.list[i]._hdImg2 = await this.getDetailsById(merchantInfo,this.list[i].itemId)
        // }

        // 	  that.list = [...that.list, ...res.data.content];
        // 	  if (that.currentPage == 1) {
        // 	    that.list = res.data.content
        // 	  }
        // 	  let itemsList = res.data;
        // 	  that.page_total = Math.ceil(res.data.total / that.pageSize);
        // 	  // 判断是否显示已加载全部数据
        // 	  if (that.page_total == that.currentPage) {
        // 	    this.hasMore = 1;
        // 	  } else {
        // 	    this.hasMore = 0;
        // 	  }
        // 	  // 策略价格
        // 	  var s_item = [];
        // 	  for (var i in that.list) {
        // 	    s_item = that.list[i];
        // 	    if (!!that.list[i].strategies) {
        // 	      that.$commonFunction.priceRulesDeal(that.list[i].strategies).then(res => {
        // 	        if (res.price !== 0) {
        // 	          that.list[i].price = res.price;
        // 	        }
        // 	        if (res.rulesArr.length > 0) {
        // 	          that.list[i].rulesArr = res.rulesArr;
        // 	        }
        // 	      }).catch(err=> {
        // 	      })
        //         // let result = await getApp().priceRulesDeal(that.list[i].strategies);
        // 	      // if (result.price !== 0) {
        // 	      //   that.list[i].price = result.price;
        // 	      // }
        // 	      // if (result.rulesArr.length > 0) {
        // 	      //   that.list[i].rulesArr = result.rulesArr;
        // 	      // }
        // 	    }

        // 	    var customPromotionTags = [];
        // 	    var isForwardpurchaseGoods = false;
        // 	    for (var t in s_item['promotionTagList']) {
        // 	      var tagItem = s_item['promotionTagList'][t];
        // 	      if (tagItem.promotionType == 'custom_tag') {
        // 	        customPromotionTags.push(tagItem);
        // 	      }

        // 	      if (tagItem.promotionType == 'forward_purchase') {
        // 	        isForwardpurchaseGoods = true;
        // 	      }
        // 	    }

        // 	    let tempTagList = customPromotionTags.slice();
        // 	    tempTagList.sort((a, b) => {
        // 	      return a.sortOrder - b.sortOrder;
        // 	    });

        // 	    that.list[i]['customPromotionTags'] = tempTagList;
        // 	    that.list[i]['isForwardpurchaseGoods'] = isForwardpurchaseGoods;
        // 	  }

        // 	  that.showLoaded = false;
        // 	  //重新组合包含banner的商品列表
        // 	  that.newList();

        // const json = await api.getGoodsList({
        //   method:'GET',
        //   query: {
        //     q: q,
        //     class_id: class_id || '',
        //     page_no: that.currentPage,
        //     page_size: that.pageSize,
        //     store_id: merchantInfo.cloudMerchantStoreId || store_id,
        //     merchant_id: merchantInfo.cloudMerchantId || merchant_id,
        //     is_sort: is_sort,
        //     color_filter: color_filter,
        //     material_filter: material_filter,
        //     size_filter: size_filter,
        //     style_filter: style_filter,
        //     group_id: customerInfo.groupId || 0,
        //     member_level_id: memberDetails.memberLevelId || 0,
        //     member_status: memberDetails.isActive || 'Inactive'
        //   }
        // });
        // if (json.code === 1000) {
        //   if (that.currentPage == 1 && json.data.content.length == 0) {
        //     that.is_empty = true;
        //     that.showmessageSeach = true;
        //   }
        //   that.list = [...that.list, ...json.data.content];
        //   if (that.currentPage == 1) {
        //     that.list = json.data.content;
        //   }
        //   let itemsList = json.data;
        //   that.colorFilter = itemsList.color_filter_data;
        //   that.materialFilter = itemsList.material_filter_data;
        //   that.sizeFilter = itemsList.size_filter_data;
        //   that.styleFilter = itemsList.style_filter_data;
        //   that.page_total = Math.ceil(json.data.total / 16);
        //   // 策略价格
        //   var s_item = [];
        //   for (var i in that.list) {
        //     s_item = that.list[i];
        //     if (!!that.list[i].strategies) {
        //       let result = await getApp().priceRulesDeal(that.list[i].strategies);
        //       if (result.price !== 0) {
        //         that.list[i].price = result.price;
        //       }
        //       if (result.rulesArr.length > 0) {
        //         that.list[i].rulesArr = result.rulesArr;
        //       }
        //     }

        //     var customPromotionTags = [];
        //     var isForwardpurchaseGoods = false;
        //     for (var t in s_item['promotionTagList']) {
        //       var tagItem = s_item['promotionTagList'][t];
        //       if (tagItem.promotionType == 'custom_tag') {
        //         customPromotionTags.push(tagItem);
        //       }

        //       if (tagItem.promotionType == 'forward_purchase') {
        //         isForwardpurchaseGoods = true;
        //       }
        //     }

        //     let tempTagList = customPromotionTags.slice();
        //     tempTagList.sort((a, b) => {
        //       return a.sortOrder - b.sortOrder;
        //     });

        //     that.list[i]['customPromotionTags'] = tempTagList;
        //     that.list[i]['isForwardpurchaseGoods'] = isForwardpurchaseGoods;
        //   }
        //   // 搜索错误提示
        //   if (q != '' && that.page_total == 0 && that.list.length < 1) {
        //     that.searchError = true;
        //   } else {
        //     that.searchError = false;
        //   }
        //   that.showLoaded = false;

        //   //重新组合包含banner的商品列表
        //   that.newList();
        // } else {
        //   that.showLoaded = false;
        // }
        that.showLoading = false;
        that.show = false;

        if (q != "") {
          this.$EFSTracking.trackingAction("SEARCH", this.defaultKeyword, {});
        }
      },

      /**
       * @param {Object} size
       * category cmsbanner 位置判断 Begin
       */
      //分类页banner列表
      categoryCmsBanners: async function() {
        let that = this;
        const json = await api.categoryCmsBanners({
          query: {
            advertise_scene: "LIST_PAGE",
            merchant_id: that.merchantId,
            store_id: that.storeId,
            reference_id: that.cateCode ? that.cateCode : "",
          },
        });
        that.bannerPosition = [];
        that.banners = [];
        that.bannerContents = [];
        that.tempListLength = [];
        if (json.code === 200) {
          let bannerList = json.data;
          if (bannerList.length > 0 && !!that.cateCode) {
            for (var i = 0; i < bannerList.length; i++) {
              let advertiseAddtional = JSON.parse(
                bannerList[i].advertiseAddtional
              );
              let bannerCateId = JSON.stringify(advertiseAddtional.id);
              //只取当前分类相关banner
              if (bannerCateId == that.cateCode) {
                if (that.preview) {
                  that.bannerContents.push(bannerList[i].bannerConfigPreview);
                } else {
                  that.bannerContents.push(bannerList[i].bannerConfig);
                }
              } else if (bannerCateId.indexOf(parseInt(that.cateCode)) > -1) {
                if (that.preview) {
                  that.bannerContents.push(bannerList[i].bannerConfigPreview);
                } else {
                  that.bannerContents.push(bannerList[i].bannerConfig);
                }
              }
            }
          }

          if (that.bannerContents.length > 0) {
            for (var j = 0; j < that.bannerContents.length; j++) {
              let tempBanners = JSON.parse(that.bannerContents[j]);
              that.banners.push(tempBanners);
            }

            let temBannerItems = [];
            if (that.banners.length > 0) {
              for (var i = 0; i < that.banners.length; i++) {
                for (var k = 0; k < that.banners[i].length; k++) {
                  if (that.banners[i][k].contents != "") {
                    let position = that.banners[i][k].position;
                    //判断banner是否有效
                    let startTime = that.banners[i][k].startTime;

                    startTime = startTime.substring(0, 19);
                    startTime = startTime.replace(/-/g, "/");
                    let startTimeTimestamp = new Date(startTime).getTime();

                    let endTime = that.banners[i][k].endTime;
                    endTime = endTime.substring(0, 19);
                    endTime = endTime.replace(/-/g, "/");
                    let endTimeTimestamp = new Date(endTime).getTime();
                    if (
                      startTimeTimestamp <= new Date().getTime() &&
                      new Date().getTime() < endTimeTimestamp
                    ) {
                      //当为底部banner时 position设置为10000 方便判断
                      if (position == -1) {
                        position = 10000;
                        that.footerBannerPosition = 10000;
                      }
                      that.bannerPosition.push(position);
                      for (let c in that.banners[i][k].contents) {
                        temBannerItems = JSON.parse(
                          that.banners[i][k].contents[c].content
                        );
                      }

                      let tempBannerContents = {
                        bannerContents: temBannerItems,
                        position: position,
                        isRow: that.banners[i][k].isRow,
                        title: that.banners[i][k].title,
                      };
                      that.bannerItemsArr[position] = tempBannerContents;
                    }
                  }
                }
              }
            }
          }
        }
        //重新组合包含banner的商品列表
        that.newList();
      },

      newList: async function() {
        let that = this;
        let tempList = that.list;
        let tempBannerPosition = that.bannerPosition;
        let tempArr = [];
        this.listResult1 = [];
        this.listResult2 = [];
        // for(let i in tempList){
        for (var i = 0; i < tempList.length; i++) {
          //去重
          for (var j = i + 1; j < tempList.length; j++) {
            if (
              tempList[i].itemId !== undefined &&
              tempList[j].itemId !== undefined
            ) {
              if (
                tempList[i].itemId == tempList[j].itemId &&
                tempList[i].valueId == tempList[j].valueId
              ) {
                //第一个等同于第二个，splice方法删除第二个
                tempList.splice(j, 1);
                j--;
              }
            }
          }
          if (tempBannerPosition.indexOf(parseInt(i)) !== -1) {
            if (that.tempListLength.indexOf(parseInt(i)) == -1) {
              var p = 0;
              for (let b in tempBannerPosition) {
                if (tempBannerPosition[b] < i) {
                  if (tempBannerPosition[b] > 1) {
                    p++;
                  }
                }
              }

              if (i > 1) {
                tempList.splice(parseInt(i) + p, 0, that.bannerItemsArr[i]);
              } else {
                tempList.splice(parseInt(i) - 1, 0, that.bannerItemsArr[i]);
              }
              tempArr.push(parseInt(i));
            }
          }
        }
        that.tempListLength = [...that.tempListLength, ...tempArr];
        // that.listResult = [...that.listResult,...tempList];
        that.listResult = tempList;
        let arr = that.listResult;
        for (var i = 0; i < arr.length; i++) {
          if (i % 2 == 0) {
            that.listResult1.push(arr[i]);
          } else {
            that.listResult2.push(arr[i]);
          }
        }
        // let ballotGoodsList = await this.$commonFunction.searchBuildBallotGoodsData(
        //     that.listResult
        //   );

        //   const list1=[]
        //   const list2=[]

        //   for (var i = 0; i < ballotGoodsList.length; i++) {
        //     if (i % 2 == 0) {
        //       list1.push(ballotGoodsList[i]);
        //     } else {
        //       list2.push(ballotGoodsList[i]);
        //     }
        //   }
        // this.listResult1=list1
        // this.listResult2=list2
        // this.resultList = ballotGoodsList||[]
        // this.listResult1 = await this.$commonFunction.searchBuildBallotGoodsData(this.resList1);
        // this.listResult2 = await this.$commonFunction.searchBuildBallotGoodsData(this.resList2);

        that.$forceUpdate();
      },

      /**
       * 清空历史记录
       */
      clearUserKeywords: async function() {
        this.keywordhisList = [];
        uni.removeStorageSync("keywordhisList");
      },

      /**
       * 获取热词列表
       */

      getKeyWordHisList: async function(visibility, merchantId, storeId) {
        const json = await api.searchKeywordList({
          query: {
            merchant_id: merchantId,
            store_id: storeId,
            visibility: visibility,
          },
        });
        if (json.code == 1000) {
          let hotWordItems = json.data.content;
          let h_hotWort = [];
          for (let i in hotWordItems) {
            h_hotWort = hotWordItems[i];
            if (h_hotWort.visibility == 1) {
              this.hotWordList.push(h_hotWort);
            }
          }
          if (this.hotWordList.length == 0) {
            this.showhotWordList = false;
          }
        }
      },
      /** 21岁弹窗确认 */
      onRegisterWidgetFinish(e) {
        return null
      },
      /**
       * 记录用户搜索热词
       */
      getUserSearchTerm: async function(searchTerm) {
        let searchUid = uni.getStorageSync("searchUid") || "";
        const json = await api.recordSearchTerm({
          method: "POST",
          query: {
            merchantId: this.merchantId,
            searchTerm: searchTerm,
            storeId: this.storeId,
            uid: searchUid,
          },
        });
      },

      /**
       * 搜索
       */
      inputValue(e) {
        this.defaultKeyword = e.detail.value.replace(/\s*/g, "");
        if (this.defaultKeyword.length > 0) {
          this.showSearchClear = true;
        } else {
          this.showSearchClear = false;
        }

        if (e.detail.cursor == 0) {
          this.show = true;
          this.searchError = false;
          this.listResult = [];
        }
      },

      getfocus(e) {
        if (this.defaultKeyword.length > 0) {
          this.showSearchClear = true;
        } else {
          this.showSearchClear = false;
        }
        this.$commonSensors.searchActive("搜索框");
      },

      bindClose() {
        if (this.defaultKeyword.length > 0) {
          this.defaultKeyword = "";
          this.showSearchClear = false;
          this.show = true;
          this.searchError = false;
          this.listResult = [];
        }
      },
      searchKeyWord: async function(e) {
        // this.resultList = []
        let that = this;
        this.is_sort = "";
        this.color_filter = "";
        this.material_filter = "";
        this.size_filter = "";
        this.style_filter = "";
        (this.isSort = 1), //是否显示排序
        (this.isFilter = ""), //是否显示筛选
        (this.searchError = false);

        var searchValue = this.defaultKeyword;
        this.categoryName = searchValue;

        var discountName = this.defaultKeyword["search-input"] ?
          this.defaultKeyword["search-input"] :
          this.defaultKeyword;


        this.defaultKeyword = discountName;
        if (this.cateCode == undefined && searchValue === "") {
          this.handleShowTextToast("请输入搜索词");
          // return;
        } else {
          this.list = [];
          this.currentPage = 1;
          this.is_empty = false;
          this.showLoading = false;
          this.showSearchClear = false;
          if (discountName !== "") {
            if (this.keywordhisList.indexOf(discountName) < 0) {
              this.keywordhisList.push(discountName);
              uni.setStorageSync("keywordhisList", this.keywordhisList);
            }
          }
          this.storeId = uni.getStorageSync(MERCHANT_INFO).cloudMerchantStoreId;
          await this.doSearchGoods(
            "",
            "",
            "",
            this.storeId,
            this.defaultKeyword,
            "",
            "",
            "",
            "",
            ""
          );

          this.getUserSearchTerm(this.defaultKeyword);
          //输入关键字埋点
          let clTrackPrams = {
            c_search_type: "输入关键字",
            c_search_keyword: this.defaultKeyword,
          };
          // this.$commonSensors.searchResult()
          getApp().commonClTrack("c_ebmp_search", clTrackPrams);
          this.$sr.track("search", {
            keyword: this.defaultKeyword,
            // act_method: '搜索框'
            // more...
          });
          this.searchType = "自然搜索";
          setTimeout(function() {
            that.$commonSensors.searchResult(
              that.defaultKeyword,
              "自然搜索",
              that.list,
              ""
            );
          }, 1000);
        }

        // 自然搜索埋点
        const searchArr = that.listResult
        let searchParams = {
          keyword: this.defaultKeyword || "",
          has_result: searchArr.length > 0,
          search_method: '自然搜索',
          product_sku_list: [],
          product_name_list: []
        }

        for (let i = 0; i < searchArr.length; i++) {
          const _el = searchArr[i]
          searchParams.product_sku_list.push(_el.itemCode)
          searchParams.product_name_list.push(_el.itemName)
        }
        this.$commonSensors.paramsTrack('SearchResultExpo',searchParams)
      },

      //加载更多
      onReachBottom() {
        let that = this;
        that.merchantId = uni.getStorageSync(MERCHANT_INFO).cloudMerchantId;
        that.storeId = uni.getStorageSync(MERCHANT_INFO).cloudMerchantStoreId;
        that.showLoading = true;
        //判断总页数是否大于翻页数
        if (that.page_total > that.currentPage) {
          //防止重复加载
          if (that.preventRepeatReuqest) {
            return true;
          }
          that.preventRepeatReuqest = true;
          that.currentPage++;
          let classId = "";
          if (this.cateCode != undefined) {
            classId = this.cateCode;
          }
          if (classId != "" || this.defaultKeyword != "") {
            that.doSearchGoods(
              classId,
              "",
              "",
              that.storeId,
              this.defaultKeyword,
              this.is_sort,
              this.color_filter,
              this.material_filter,
              this.size_filter,
              this.style_filter
            );
          }
          that.preventRepeatReuqest = false;
        } else {
          that.showLoading = false;
        }
      },

      // 按排序显示商品列表
      currentType(obj) {
        this.list = [];
        this.currentPage = 1;
        this.is_sort = obj.is_sort;
        this.is_empty = false;
        this.show = false;
        this.doSearchGoods(
          this.cateCode,
          "",
          "",
          this.storeId,
          this.defaultKeyword,
          this.is_sort,
          this.color_filter,
          this.material_filter,
          this.size_filter,
          this.style_filter
        );
      },

      // 按筛选条件排序
      arrowType(obj) {
        this.color_filter = obj.color_filter;
        this.material_filter = obj.material_filter;
        this.size_filter = obj.size_filter;
        this.style_filter = obj.style_filter;
        this.list = [];
        this.currentPage = 1;
        this.doSearchGoods(
          this.cateCode,
          "",
          "",
          this.storeId,
          this.defaultKeyword,
          this.is_sort,
          this.color_filter,
          this.material_filter,
          this.size_filter,
          this.style_filter
        );
      },

      /**
       * 热词和历史记录的搜索
       */
      async selHisKeyWord(e) {
        // this.resultList = []
        let that = this;
        this.list = [];
        this.currentPage = 1;
        var discountName = e.target.dataset.text || e.currentTarget.dataset.text;
        this.showLoading = true;
        this.defaultKeyword = discountName ?
          discountName.replace(/\s*/g, "") :
          discountName;
        if (discountName !== "") {
          if (this.keywordhisList.indexOf(discountName) < 0) {
            this.keywordhisList.push(discountName);
            uni.setStorageSync("keywordhisList", this.keywordhisList);
          }
        }
        this.$sr.track("search", {
          keyword: this.defaultKeyword,
          // act_method: '搜索按钮'
          // more...
        });
        this.storeId = uni.getStorageSync(MERCHANT_INFO).cloudMerchantStoreId;
        this.doSearchGoods(
          "",
          "",
          "",
          this.storeId,
          this.defaultKeyword,
          "",
          "",
          "",
          "",
          ""
        );
        this.getUserSearchTerm(this.defaultKeyword);
        //热门搜索历史搜素埋点
        let clTrackPrams = {
          c_search_type: e.target.dataset.type || e.currentTarget.dataset.type,
          c_search_keyword: e.target.dataset.text || e.currentTarget.dataset.text,
        };
        getApp().commonClTrack("c_ebmp_search", clTrackPrams);
        this.searchType = "热门搜索";
        setTimeout(function() {
          that.$commonSensors.searchResult(
            that.defaultKeyword,
            "热门搜索",
            that.list,
            ""
          );
        }, 1000);
      },

      clearHis() {
        this.clearUserKeywords();
      },
      // onShareAppMessage: function(res) {
      //   // 分享卡片图片
      //   let memberCode = uni.getStorageSync('memberCode') || '';

      //   let sharePath ='/pages/search/search?type=' + this.type + '&keyword=' + this.defaultKeyword

      //   let pageTitle = uni.getStorageSync('storeName');
      //   if (res.from === 'button') {
      //     // 来自页面内转发按钮
      //   }
      //   this.$EFSTracking.trackingAction('SHARE_CARD', res.from, {});
      //   return this.$commonFunction.commonShare(res,pageTitle, sharePath, this.shareImage);
      // }
    },
    // onShareTimeline() {
    //   return {
    //     title: uni.getStorageSync('storeName') || '小程序商城',
    //     query: '/pages/item/categoryNew?cateCode=' + this.cateCode
    //   };
    // }
  };
</script>

<style lang="less">
  .history {
    padding: 48rpx 48rpx 0;

    .title {
      display: flex;
      justify-content: space-between;
    }

    .lable {
      margin-top: 32rpx;
      display: flex;
      flex-wrap: wrap;
      align-items: center;

      .child {
        display: inline-block;
        margin-right: 20rpx;
        margin-bottom: 20rpx;
        padding: 10rpx 20rpx;
        font-size: 24rpx;
        background: #f2f2f2;
        border-radius: 168rpx;
        font-family: FrankNew-Regular, NotoSansSC-Regular;
      }
    }
  }

  .doc {
    font-size: 32rpx;
		font-family: NotoSansSC-Medium;
  }

  .content {
    display: none;
  }

  .search_read_only {
    padding: 0;
    width: auto;
    // margin: 48rpx 24rpx 0;
    margin-top: 48rpx;

    .search_content {
      width: 100%;
      border-radius: 0;
      padding: 0;
      background: none;

      position: relative;

      .icon-fangdajing {
        color: #333333;
        font-size: 36rpx;
        margin-top: -1px;
        margin-left: 15rpx;
      }

      .search_input {
        font-family: FrankNew-Medium;
        font-size: 24rpx;
        font-weight: 400;
        margin: 0 16rpx;
      }

      .search_right {
        display: flex;
        align-items: center;
        justify-content: center;

        .mcl-guanbi1 {
          width: 70px;
          height: 30px;
          text-align: right;
          font-size: 30rpx;
          font-weight: 700;
          padding-right: 15px;
          display: flex;
          justify-content: flex-end;
          align-items: center;
        }

        .right-Item {
          font-family: NotoSansSC-Regular;
          font-size: 24rpx;
          width: 104rpx;
          height: 56rpx;
          border-radius: 48rpx;
          color: #ffffff;

          // transform: rotate(180deg);
          // width: 54rpx;
          // height: 54rpx;
          // border: 1.5px solid #000;
          background: #000;
          // border: 1.5px solid #996666;
          // background: #993333;
          display: flex;
          align-items: center;
          justify-content: center;
        }

        .icon-jiantouxiangzuo {
          color: #fff;
          font-size: 36rpx;
        }
      }
    }
  }

  .search-suggestions {
    padding: 30rpx 80rpx;
    display: block;
  }

  .btn_box .btn_2 {
    border: 1px solid #e7e7e7;
    background-color: #fff;
    margin-top: 40rpx;
    color: #444;
  }

  .icon-search {
    width: 28rpx;
    height: 28rpx;
    margin-top: 3px;
  }

  .icon-lajitong {
    font-size: 30rpx;
    float: right;
  }

  .phcolor {
    color: #999999;
  }

  .fix-iphonex-button::after {
    content: " ";
    position: fixed;
    bottom: 0 !important;
    height: auto !important;
    width: 100%;
    background: #fff;
  }

  .searchTip {
    width: 100%;
    height: 100%;
    padding: 40rpx 0 0 20rpx;
    letter-spacing: 0.04em;
    font-size: 26rpx;
    background: #fff;
    color: #444;
  }

  .searchTipHide {
    display: none;
  }

  .pb120 {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 48rpx 48rpx 0;
    background-color: #fff;

    .pb60 {
      width: calc(50% - 8rpx);
    }
  }

  .hasMore {
    font-size: 12px;
    color: #444;
    background: #f7f5f4;
    width: 100%;
    text-align: center;
    padding-bottom: 48rpx;
    padding-top: 20rpx;
  }

  .search-small-icon {}

  .searchIptBx {
    height: 64rpx;
    width: 64rpx;
    text-align: center;
    line-height: 64rpx;
  }

  .top_search {
    padding: 0 48rpx;
  }

  .serach_img {
    width: 64rpx;
    height: 64rpx;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .search_btm_line {
    width: 100%;
    border-top: 2rpx solid #e7e7e7;
    margin-top: 30rpx;
  }
</style>
